package com.crm.controller;

import com.crm.base.BaseController;
import com.crm.domain.entity.Role;
import com.crm.result.Result;
import com.crm.service.RoleService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * 角色控制器
 */
@RestController
@RequestMapping("/role")
public class RoleController extends BaseController<RoleService, Role> {

    // 新增权限
    @RequestMapping("/auth")
    public Result<Boolean> addPer(Integer roleId, Integer[] moduleIds, HttpSession session) {
        return baseService.addPermission(roleId, moduleIds, session) ? Result.success() : Result.failure();
    }
}
